import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
    redirect: "/home/index",
  },
  // home首页
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/每时每刻/home/home.vue"),
    children: [
      // 首页
      {
        path: "/home/index",
        name: "index",
        component: () => import("@/views/每时每刻/index/index.vue"),
      },
      // 课程
      {
        path: "/home/course",
        name: "course",
        component: () => import("@/views/每时每刻/course/course.vue"),
      },
      // 约课记录
      {
        path: "/home/record",
        name: "record",
        component: () => import("@/views/每时每刻/record/record.vue"),
      },
      // 练习
      {
        path: "/home/practise",
        name: "practise",
        component: () => import("@/views/每时每刻/practise/practise.vue"),
      },
      // 个人中心
      {
        path: "/home/person",
        name: "person",
        component: () => import("@/views/每时每刻/person/person.vue"),
      },
    ],
  },
  // 详情页
  {
    path: "/Ly_detail",
    name: "Ly_detail",
    component: () => import("@/views/每时每刻/index/Ly_detail.vue"),
  },
  // 登陆
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/每时每刻/person/login/login.vue"),
  },
  // 注册用户
  {
    path: "/login-zhuce",
    name: "zhuce",
    component: () => import("@/views/每时每刻/person/login/zhucelogin.vue"),
  },
  // 设置密码
  {
    path: "/userpassword-set",
    name: "userpassword",
    component: () => import("@/views/每时每刻/person/login/setpassword.vue"),
  },
  {
    path: "/yjq_search",
    name: "yjq_search",
    component: () => import("../views/每时每刻/course/search.vue"),
  },

  // 跳转考点专练
  {
    path: "/practiseF",
    name: "practiseF",
    component: () => import("@/views/每时每刻/practise/practiseF.vue"),
  },

  // 用户信息
  {
    path: "/info",
    name: "info",
    component: () => import("@/views/每时每刻/person/info.vue"),
  },
  // 修改用户昵称
  {
    path: "/nickname",
    name: "nickname",
    component: () => import("@/views/每时每刻/person/nickname.vue"),
  },
  // 修改用户性别
  {
    path: "/sex",
    name: "sex",
    component: () => import("@/views/每时每刻/person/sex.vue"),
  },
  // 修改用户学科
  {
    path: "/xueli",
    name: "xueli",
    component: () => import("@/views/每时每刻/person/xueli.vue"),
  },
];

const router = new VueRouter({
  routes,
});
//import HelloWorld from '@/components/HelloWorld'
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
export default router;
